﻿using System;
using Framework;

public class SwitchEventEnableEventEffector : BaseEventEffector
{
    public int EventID;
    public bool Enable;

    public override void DoEvent(ObjHandle<LogicEntity> owner, params object[] allParams)
    {
        owner.handle.GetLogicComponent<LogicEventComponent>().GetEvent(EventID).Enabled = Enable;
    }

    public override void OnDestroy()
    {
    }

    public override void Serialize(EByte ms)
    {
        ms.WriteInt(EventID);
        ms.WriteInt(Enable ? 1 : 0);
    }

    public override void Deserialize(EByte ms)
    {
        EventID = ms.ReadInt();
        Enable = ms.ReadInt() == 1;
    }

}
